﻿using UnityEngine;
using System.Collections.Generic;
using Dict;
using Dict.DataModel;

namespace Dict.Blo
{
    public class TableTalentBlo
    {
        public static TableTalent GetTalentById(string id)
        {
            return DictDataManager.Instance.tableTalentDao.GetById(id);
        }

        public static List<TableTalentAdvenced> GetTalentAdvanceData(string heroId)
        {
            return DictDataManager.Instance.tableTalentAdvencedDao.GetByOneIndex(heroId);
        }

        public static bool IsTalentHaveChildren(List<TableTalentAdvenced> talents,string talentLevel)
        {
            foreach(var item in talents)
            {
                if(item.trunck == 1 && (item.parent == talentLevel || item.parent2 == talentLevel))
                {
                    return true;
                }
            }
            return false;
        }

        public static bool IsTalentHaveBrunchChildren(List<TableTalentAdvenced> talents, string talentLevel)
        {
            foreach (var item in talents)
            {
                if (item.trunck == 0 && (item.parent == talentLevel || item.parent2 == talentLevel))
                {
                    return true;
                }
            }
            return false;
        }
    }
}